extends Node3D

signal round_started
signal round_ended
signal game_over

enum GamePhase { PREPARATION, BATTLE, GAME_OVER }

var current_phase: GamePhase = GamePhase.PREPARATION
var current_round: int = 1
var player_health: int = 100
var player_gold: int = 10
var player_level: int = 1

@onready var board_manager = $Board
@onready var camera_controller = $CameraController

func _ready():
	print("Game Manager initialized")
	print("Starting Round: ", current_round)
	start_preparation_phase()

func start_preparation_phase():
	current_phase = GamePhase.PREPARATION
	print("Preparation Phase - Round ", current_round)
	
func start_battle_phase():
	current_phase = GamePhase.BATTLE
	print("Battle Phase - Round ", current_round)
	emit_signal("round_started")
	
func end_round():
	emit_signal("round_ended")
	current_round += 1
	player_gold += 5
	start_preparation_phase()
	
func take_damage(amount: int):
	player_health -= amount
	if player_health <= 0:
		end_game()
		
func end_game():
	current_phase = GamePhase.GAME_OVER
	emit_signal("game_over")
	print("Game Over!")